package com.qf.openapi.web.master.jsoup;


import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.junit.Test;

import java.io.IOException;

public class HelloJsoup {


    @Test
    public void testJsoup() throws IOException {
        Document doc = Jsoup.connect("http://fjisu2.com/acg/3736/").get();

        final Elements elements = doc.select("ul.details-con2-list");

        for (Element element : elements) {

            final Element li = element.selectFirst("li");

            System.out.println(li.text());

        }
    }


    @Test
    public void testLast() throws IOException {
        Document doc = Jsoup.connect("https://www.imitui.com/manhua/haizeiwang/").get();
//        System.out.println(doc);

        final Element element = doc.selectFirst("ul.detail-list");
//        System.out.println(elements.size());

//        System.out.println(element);

        final Elements lis = element.select("li");

//        System.out.println(lis.size());

        final Element last = lis.last();

//        System.out.println(last);

        final Element a = last.selectFirst("a");

        System.out.println(a.text());

    }
}
